#导入模块
import tkinter as tk
import math
W=tk.W
#定义函数
def e(): #按钮触发函数
   for b in range(1,100000):
        a(b)      

def a(n): #计算质数
    if n > 1:       
        for i in range(2,int(math.sqrt(n))+1):
            if  (n % i)== 0:
                 return          
        listb.insert(0,str(n))
    else:
         return
         
        

#窗口
window = tk.Tk()
window.title("质数计算程序")
window.geometry("700x500")
label=tk.Label(window,text='质数计算程序',bg="white",font=('Arial',12))
listb  =tk.Listbox(window)          
listb2 = tk.Listbox(window)
b=tk.Button(window,text="计算",command=e)
#放置
listb.place(x=40,y=160, anchor=W, width=120, height=200)                   
listb2.place(x=240,y=160, anchor=W, width=120, height=200)
label.place(x=420,y=80, anchor=W, width=120, height=40)
b.place(x=420,y=160, anchor=W, width=120, height=40)



window.mainloop()
